<template>
	<view class="content">
		<view class="info-block">
			<view class="info-list">
				<view class="project">{{info.matterName}}</view>
				<view class="time">开始时间：{{info.startTime}}</view>
				<view class="time">完成时限：<text v-if="info.completeTime">{{info.completeTime}}</text><text
						v-else>暂无</text></view>
				<view class="time">责任书记：<text v-if="info.dutyNameText">{{info.dutyNameText}}</text><text
						v-else>暂无</text></view>
				<view class="time">责任单位：{{info.unit}}</view>
				<view @click="more =!more" class="time">进展情况:<text class="more"
						v-if="info.progress.length>0">{{more?'【收起】':'【展开】'}}</text><text class="more"
						style="margin-left: 10rpx;" v-else>暂无</text></view>
				<view v-for="(item,index) in info.progress" :key="item.id" class="one" :class="more?'':'fewer'">
					<view class="onedot"></view>
					<view class="oneline"></view>
					<view class="onemain">
						<view class="onemaintitle">{{item.time}}</view>
						<view class="onemaincon">{{item.content}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		selectMatterById
	} from '@/api/search.js'
	export default {
		data() {
			return {
				info: {
					progress: [],
					matterName: '',
					startTime: '',
					completeTime: '',
					dutyNameText: '',
					unit: ''
				},
				more: false
			}
		},
		methods: {
			search() {
				this.getList()
			},
			getList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				selectMatterById({
					id: this.id
				}).then(res => {
					uni.hideLoading()
					this.info = res
				}).catch(() => {
					uni.hideLoading()
				})
			}
		},
		onLoad(e) {
			this.id = e.id
			this.getList()
		}
	}
</script>

<style lang="scss">
	.content {
		background: #f5f5f5;
		padding: 30rpx;
		min-height: 100vh;

		.search-block {
			position: relative;
			width: 100%;
			height: 60rpx;
			//padding: 0 30rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-bottom: 30rpx;

			.input-block {
				width: 100%;
				display: flex;
				flex-direction: row;
				align-items: center;
				border: 1px solid #808080;
				border-radius: 40rpx;
				padding: 0 10rpx;
				height: 60rpx;

				.iconfont {
					flex-grow: 0;
					color: #808080;
					margin: 0 10rpx;
				}

				input {
					flex-grow: 1;
					font-size: 28rpx;
					color: #808080;
					margin: 0 10rpx;
				}
			}
		}

		.info-block {
			min-height: 140rpx;
			padding: 30rpx;
			background: #fff;
			border-radius: 20rpx;
			box-shadow: 0 0 10px 0 #dedede;
			margin-bottom: 30rpx;
			height: auto;
			display: flex;
			flex-direction: column;
			justify-content: center;


			.leader {
				//width: calc(100% - 130rpx);
				font-size: 32rpx;
				font-weight: bold;
			}

			.more {
				color: $uni-color-primary;
				font-size: 30rpx;

				.iconfont {
					font-size: 30rpx;
					color: #000;
				}
			}

			.info-list.fewer {
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 1;
				overflow: hidden;
				display: none;
			}

			.info-list {
				//background: #f5f5f5;
				padding: 20rpx;
				border-radius: 20rpx;

				.project {
					font-size: 30rpx;
					font-weight: bold;
					margin-bottom: 30rpx;
					margin-top: 10rpx;
				}

				.time {
					font-size: 30rpx;
					margin-bottom: 30rpx;

					.more {
						color: $uni-color-primary;
						font-size: 30rpx;
					}
				}

				.one.fewer {
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 1;
					overflow: hidden;
					display: none;
				}

				.one {
					position: relative;
					padding-bottom: 10rpx;

					.onedot {
						left: -2rpx;
						width: 24rpx;
						height: 24rpx;
						position: absolute;
						//background-color: #4C7FE2;
						border: 1px solid #4C7FE2;
						border-radius: 50%;
						display: flex;
						justify-content: center;
						align-items: center;
						z-index: 1;
					}

					.oneline {
						position: absolute;
						left: 10rpx;
						height: calc(100% - 24rpx);
						border-left: 1px solid #1254F1;
						margin-top: 24rpx;
					}

					.onemain {
						position: relative;
						padding-left: 56rpx;
						top: -6rpx;
					}

					.onemaintitle {
						margin-bottom: 16rpx;
						padding-top: 8rpx;
						line-height: 1;
						font-size: 28rpx;
						color: #303133;
					}

					.onemaincon {
						color: #303133;
						background-color: #DFE8F9;
						padding: 20rpx;
						font-size: 28rpx;
						line-height: 60rpx;
					}
				}
			}
		}
	}
</style>